package com.massyframework.beanskin.runtime.nativelib;

import java.net.URL;
import java.util.Collection;
import java.util.Set;

import com.massyframework.beanskin.Module;
import com.massyframework.beanskin.ModuleAware;
import com.massyframework.beanskin.ModuleIdentifier;
import com.massyframework.beanskin.util.classloading.LocalResourcesPath;
import com.massyframework.beanskin.util.classloading.ModuleClassLoader;
import com.massyframework.beanskin.util.classloading.ModuleClassLoader.Builder;
import com.massyframework.beanskin.util.classloading.ResourceLocateFilterRepository;

/**
 * 加密模块类加载器构建器
 * @author huangkh
 *
 */
public final class DecryptableModuleClassLoaderBuilder extends ModuleClassLoader.Builder
	implements ModuleAware{

	protected Module<?> module;
	
	public DecryptableModuleClassLoaderBuilder() {
		
	}
			
	@Override
	public void setModule(Module<?> module) {
		this.module = module;
	}

	/**
	 * 设置解密公钥
	 * @param value {@link String}
	 * @return {@link Builder}
	 */
	public DecryptableModuleClassLoaderBuilder publicKey(String value) {
		super.publicKey(value);
		return this;
	}
	
	@Override
	public DecryptableModuleClassLoaderBuilder certificate(String name, String data) {
		super.certificate(name, data);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder hotDeployment(boolean value) {
		super.hotDeployment(value);
		return this;
	}

	public DecryptableModuleClassLoaderBuilder decryptClassNames(Set<String> value) {
		super.decryptClassNames(value);
		return this;
	}
			
	@Override
	public DecryptableModuleClassLoaderBuilder addLocalResourcesPath(LocalResourcesPath value) {
		super.addLocalResourcesPath(value);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder addLocalResourcesPaths(Collection<LocalResourcesPath> value) {
		super.addLocalResourcesPaths(value);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder addURL(URL url) {
		super.addURL(url);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder addURLs(Collection<URL> urls) {
		super.addURLs(urls);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder parentClassLoader(ClassLoader value) {
		super.parentClassLoader(value);
		return this;
	}
	
	
	@Override
	public DecryptableModuleClassLoaderBuilder resourceLocateFilterRepository(ResourceLocateFilterRepository value) {
		super.resourceLocateFilterRepository(value);
		return this;
	}

	@Override
	public DecryptableModuleClassLoaderBuilder moduleIdentifier(ModuleIdentifier value) {
		super.moduleIdentifier(value);
		return this;
	}

	@Override
	public DecryptableModuleClassLoader build() {
		return new DecryptableModuleClassLoader(this);
	}
}
